<template>
  <img alt="Vue logo" src="./assets/logo.png">
  <HelloWorld msg="Welcome to Your Vue.js App 哈哈哈哈" @handleToParent="getHandleParent"/>
</template>

<script lang="ts">
import { provide } from '@vue/runtime-core'
import HelloWorld from './components/HelloWorld.vue'
import { useStore } from 'vuex'
import serve from './api/getData'
export default {
  name: 'App',
  components:{
    HelloWorld
  },
  setup(){
    provide('childMsg','这是给孙组件传递的信息')
    const store = useStore()
    console.log(store,'store')
    const getHandleParent = (num:Number)=>{
        console.log('父组件拿到的值：',num)
        // store.commit('updateNum')
        store.dispatch('updateNumActions')
    }
    // 接口请求
    serve.getMenu().then((res: any)=>{
      console.log(res)
    })
    return{
      getHandleParent
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
